import { defineStore } from "pinia"
import { 
  getAllOwnerList,
  addOwnerInfo,
  editOwnerInfo,
  deleteOwnerInfo
} from "@/api/owner/index"
import type { 
} from "@/api/owner/types"

export const ownerStore = defineStore('owner', {
  state: () => ({
  }),
  actions: {
    async getAllOwnerList(params) {
      try {
        const data = await getAllOwnerList(params)
        return Promise.resolve(data)
      } catch(error) {
        return Promise.reject(error)
      }
    },
    async addOwnerInfo(params) {
      try {
        const data = await addOwnerInfo(params)
        return Promise.resolve(data)
      } catch(error) {
        return Promise.reject(error)
      }
    },
    async editOwnerInfo(params) {
      try {
        const data = await editOwnerInfo(params)
        return Promise.resolve(data)
      } catch(error) {
        return Promise.reject(error)
      }
    },
    async deleteOwnerInfo(params) {
      try {
        const data = await deleteOwnerInfo(params)
        return Promise.resolve(data)
      } catch(error) {
        return Promise.reject(error)
      }
    }
  },
  getters: {
  }
})
